<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/8
 * Time: 19:30
 */

namespace app\common\model;


use think\Model;

class GameDota2 extends Model
{
    protected $name = 'game_dota2';
    protected $hidden = [
        'createtime','updatetime'
    ];
    protected $append = [
        'attr_name','line_name','num_name','type_name'
    ];
    public function getAttrNameAttr($value,$data)
    {
        switch ( $data['attr'] ){
            case 'power':
                return '力量';
                break;
            case 'agile':
                return '敏捷';
                break;
            case 'intellect':
                return '智慧';
                break;
        }
    }
    public function getLineNameAttr($value,$data)
    {
        switch ( $data['line'] ){
            case 'tianhui':
                return '天辉';
                break;
            case 'yemo':
                return '夜魔';
                break;
        }
    }

    public function getNumNameAttr($value,$data)
    {
        switch ( $data['num'] ){
            case 'double':
                return '双';
                break;
            case 'single':
                return '单';
                break;
        }
    }
    public function getTypeNameAttr($value,$data)
    {
        switch ( $data['type'] ){
            case 'close':
                return '近战';
                break;
            case 'far':
                return '远程';
                break;
        }
    }
}